package dialer.ws.base.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name = "campaign", schema = "call_center")
@NamedQueries({ @NamedQuery(name = "getCampaignByState", query = "from Campaign where estatus=:estatus") })
public class Campaign implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1820582887551860953L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;

	@Column(name = "name", nullable = false)
	private String name;

	@Column(name = "datetime_init", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
	@Temporal(TemporalType.DATE)
	private Date datetimeInit;

	@Column(name = "datetime_end", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
	@Temporal(TemporalType.DATE)
	private Date datetimeEnd;

	@Column(name = "daytime_init", nullable = false)
	@Temporal(TemporalType.TIME)
	private Date daytimeInit;

	@Column(name = "daytime_end", nullable = false)
	@Temporal(TemporalType.TIME)
	private Date daytimeEnd;

	@Column(name = "retries", nullable = false)
	private Integer retries;

	@Column(name = "trunk")
	private String trunk;

	@Column(name = "context", nullable = false)
	private String context;

	@Column(name = "queue", nullable = false)
	private String queue;

	@Column(name = "max_canales", nullable = false)
	private Integer maxCanales;

	@Column(name = "num_completadas")
	private Integer numCompletadas;

	@Column(name = "promedio")
	private Integer promedio;

	@Column(name = "desviacion")
	private Integer desviacion;

	@Column(name = "script", nullable = false, length = 16777215)
	private String script;

	@Column(name = "estatus", nullable = false, length = 1)
	private String estatus;

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "listCampaign")
	private List<Form> listForm;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "campaign")
	private List<Calls> listCalls;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getDatetimeInit() {
		return datetimeInit;
	}

	public void setDatetimeInit(Date datetimeInit) {
		this.datetimeInit = datetimeInit;
	}

	public Date getDatetimeEnd() {
		return datetimeEnd;
	}

	public void setDatetimeEnd(Date datetimeEnd) {
		this.datetimeEnd = datetimeEnd;
	}

	public Date getDaytimeInit() {
		return daytimeInit;
	}

	public void setDaytimeInit(Date daytimeInit) {
		this.daytimeInit = daytimeInit;
	}

	public Date getDaytimeEnd() {
		return daytimeEnd;
	}

	public void setDaytimeEnd(Date daytimeEnd) {
		this.daytimeEnd = daytimeEnd;
	}

	public Integer getRetries() {
		return retries;
	}

	public void setRetries(Integer retries) {
		this.retries = retries;
	}

	public String getTrunk() {
		return trunk;
	}

	public void setTrunk(String trunk) {
		this.trunk = trunk;
	}

	public String getContext() {
		return context;
	}

	public void setContext(String context) {
		this.context = context;
	}

	public String getQueue() {
		return queue;
	}

	public void setQueue(String queue) {
		this.queue = queue;
	}

	public Integer getMaxCanales() {
		return maxCanales;
	}

	public void setMaxCanales(Integer maxCanales) {
		this.maxCanales = maxCanales;
	}

	public Integer getNumCompletadas() {
		return numCompletadas;
	}

	public void setNumCompletadas(Integer numCompletadas) {
		this.numCompletadas = numCompletadas;
	}

	public Integer getPromedio() {
		return promedio;
	}

	public void setPromedio(Integer promedio) {
		this.promedio = promedio;
	}

	public Integer getDesviacion() {
		return desviacion;
	}

	public void setDesviacion(Integer desviacion) {
		this.desviacion = desviacion;
	}

	public String getScript() {
		return script;
	}

	public void setScript(String script) {
		this.script = script;
	}

	public String getEstatus() {
		return estatus;
	}

	public void setEstatus(String estatus) {
		this.estatus = estatus;
	}

	public List<Form> getListForm() {
		return listForm;
	}

	public void setListForm(List<Form> listForm) {
		this.listForm = listForm;
	}

	public List<Calls> getListCalls() {
		return listCalls;
	}

	public void setListCalls(List<Calls> listCalls) {
		this.listCalls = listCalls;
	}
}
